declare const send_msg: any;
declare const msg_content: any;

export interface ICommonParams {
	body?: any;
	cookie: {
		[name: string]: string;
	};
	data: any;
	headers: {
		[key: string]: string;
	};
	params: any;
	query: any;
	remote_address: string;
	spaceid: string;
	url: string;
	[key: string]: any;
}
export interface IWebResult {
	data?: any;
	buff?: Buffer;
	cookie?: {
		[name: string]: string;
	};
	content_type?: string;
	headers?: {
		[key: string]: string;
	};
	attachment?: string;
	redirect?: string;
	status_code?: number;
}

export default async function atom(msg: ICommonParams) {
	const query = msg_content.query;
	const sessionid = query.sessionid;
	const headers = msg_content.headers;
	const obj: any = { data: { code: 0, user: null, msg: null } };
	try {
		const res: any = await send_msg('loginservice.getuserinfobysessionid', { spaceid, sessionid });
		console.log('-------------', res);
		obj.data.code = 1;
		obj.data.user = res;
		return obj;
	} catch (error) {
		console.log('-------------', error);
		obj.data.msg = error ? error.toString() : '';
		return obj;
	}
}
